//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES OR INDEMNITIES.
//
//////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2003 Intrinsyc Europe Ltd.
//////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2004 Siemens AG
//
// Version: 1.1.2.5
// Date:    11. Jan. 2006
//////////////////////////////////////////////////////////////////////////////


#pragma once

//
// Call status values
//
static const DWORD g_rgdwCallStats[] =
{
    RIL_CALLSTAT_ACTIVE,            // 0
    RIL_CALLSTAT_ONHOLD,            // 1
    RIL_CALLSTAT_DIALING,           // 2
    RIL_CALLSTAT_ALERTING,          // 3
    RIL_CALLSTAT_INCOMING,          // 4
    RIL_CALLSTAT_WAITING,           // 5
    0,                              // 6 (terminating: The call is not active anymore, but inband information is still available)
    0,                              // 7 (dropped: The call has been suspended by the network, but may be resumed later)
};
#define NUM_CALLSTATS   (sizeof(g_rgdwCallStats) / sizeof(DWORD))

//
// Call type values
//
static const DWORD g_rgdwCallTypes[] =
{
    RIL_CALLTYPE_VOICE,             // 0
    RIL_CALLTYPE_DATA,              // 1
    RIL_CALLTYPE_FAX,               // 2
    RIL_CALLTYPE_UNKNOWN,           // 3
    RIL_CALLTYPE_UNKNOWN,           // 4
    RIL_CALLTYPE_UNKNOWN,           // 5
    RIL_CALLTYPE_UNKNOWN,           // 6
    RIL_CALLTYPE_UNKNOWN,           // 7
    RIL_CALLTYPE_UNKNOWN,           // 8
    RIL_CALLTYPE_UNKNOWN,           // 9
};
#define NUM_CALLTYPES   (sizeof(g_rgdwCallTypes) / sizeof(DWORD))

static const DWORD g_rgdwCpiStat[] =
{
    RIL_CPISTAT_NEW_INCOMING,       // 0
    RIL_CPISTAT_DISCONNECTED,       // 1
    RIL_CPISTAT_NEW_OUTGOING,       // 2
    RIL_CPISTAT_UNKNOWN,            // 3
    RIL_CPISTAT_UNKNOWN,            // 4
    RIL_CPISTAT_UNKNOWN,            // 5
    RIL_CPISTAT_CONNECTED,          // 6
};
#define NUM_CPISTATS    (sizeof(g_rgdwCpiStat) / sizeof(DWORD))

#define CALLCTRL_ALLOC_NUMBER        16
#define MAX_EMERGENCYNO 10
// Shortcut to access priority port search function.
#define PRIORITY_PORT	 g_ComManager.GetPriorityPort(pHandle->GetDevice())
#define ORDER_PRIORITY_PORT	 g_ComManager.GetPriorityPortKeepOrder(pHandle->GetDevice())

#define DEFAULT_SNFM_TIMEOUT	5000

HRESULT RILDrv_Dial(DWORD dwParam, LPCSTR szAddress, DWORD dwType, DWORD dwOptions);
HRESULT RILDrv_Answer(DWORD dwParam);
HRESULT RILDrv_Hangup(DWORD dwParam);
HRESULT RILDrv_SendDTMF(DWORD dwParam, LPCSTR lpszChars, DWORD dwDuration);
HRESULT RILDrv_GetCallList(DWORD dwParam);
HRESULT RILDrv_ManageCalls(DWORD dwParam, DWORD dwCommand, DWORD dwID);
HRESULT RILDrv_TransferCall(DWORD dwParam, const RILADDRESS* lpAddress, const RILSUBADDRESS* lpSubAddress);
HRESULT RILDrv_GetLineStatus(DWORD dwParam);
HRESULT RILDrv_GetCurrentAddressId(DWORD dwParam);
HRESULT RILDrv_SetCurrentAddressId(DWORD dwParam, DWORD dwAddressId);

HRESULT RILDrv_SendFlash(DWORD dwParam, RILADDRESS raRilAddress);

void RHADeactivateVoicePath(CRilHandle *pRILHandle);
void TestLastActiveCall(CRilHandle* const pRilDevice);
BOOL IsACallActive();
DWORD GetSNFMTimeout();

DWORD WINAPI ReCheckCallStatusThreadProc(LPVOID pVoid);
